
<%@page import="java.io.IOException"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@ page import="javax.portlet.*"%>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri='../dictlist.tld' prefix="dict"%>
<script type="text/javascript" src='/${requestScope.contextPath}/scripts/common.js' ></script>
<script type="text/javascript" src='/${requestScope.contextPath}/scripts/jquery-1.4.2.js'></script>
<script type="text/javascript">
function onSubmiting() {
    var dictID = $("#dictID").val();
    var word = $("#word").val();
    $("#meaning").load('/${requestScope.contextPath}/Translate.jsp',{dictID: dictID, word: word});
}
$(function(){
    $('#translate').click(function(){ onSubmiting();});
  });
</script>
<portlet:defineObjects />


<form action="<portlet:actionURL/>" name="<portlet:namespace/>LookUpWord" method="post">
	<input name="eventId" type="hidden" />
	<input name="screenId" type="hidden" value="searchword"/>
	<table style="width:100%;background:#FF9">
		<tr>
			<td colspan="2" style="width:100%;height:50px;background:#0F3">
            Hello ${sessionScope.username}
            
            <c:if test="${sessionScope.role == -1}">
            	<div style="float:right"><input type="submit" value="Login" onclick='submitAction("<portlet:namespace/>", "LookUpWord", "login");'/></div>
            	<div style="float:right"><input type="submit" value="Contribute" onclick='submitAction("<portlet:namespace/>", "LookUpWord", "contribute");'/></div>
            </c:if>
            
            <c:if test="${sessionScope.role == 0}">
            	<div style="float:right"><input type="submit" value="Logout" onclick='submitAction("<portlet:namespace/>", "LookUpWord", "logout");'/></div>
            	<div style="float:right"><input type="submit" value="Contribute" onclick='submitAction("<portlet:namespace/>", "LookUpWord", "contribute");'/></div>
            </c:if>
            
            <c:if test="${sessionScope.role == 1 or sessionScope.role == 2}">
            	<div style="float:right"><input type="submit" value="Logout" onclick='submitAction("<portlet:namespace/>", "LookUpWord", "logout");'/></div>
            	<div style="float:right"><input type="submit" value="Manager Home" onclick='submitAction("<portlet:namespace/>", "LookUpWord", "managerhome");'/></div>
            	<div style="float:right"><input type="submit" value="Contribute" onclick='submitAction("<portlet:namespace/>", "LookUpWord", "contribute");'/></div>
            </c:if>
            
            <c:if test="${sessionScope.role == 3}">
            	<div style="float:right"><input type="submit" value="Logout" onclick='submitAction("<portlet:namespace/>", "LookUpWord", "logout");'/></div>
            	<div style="float:right"><input type="submit" value="Administrator Home" onclick='submitAction("<portlet:namespace/>", "LookUpWord", "adminhome");'/></div>
            	<div style="float:right"><input type="submit" value="Contribute" onclick='submitAction("<portlet:namespace/>", "LookUpWord", "contribute");'/></div>
            </c:if>
            
            </td>
      	</tr>
        <tr>
            <td width="20%">
	        	<table width="100%">
                	<tr><td colspan="2">Dictionary</td></tr>
                    <tr><td colspan="2">
                    	<select name="dictID" style="width:150px" id="dictID">
                    		<dict:dictlist/>
                        </select>
                    </td></tr>
                    <tr>
                    	<td colspan="2">Word :</td>
                    </tr>
                    <tr>
                    	<td width="70%"><input type="text" width="100%" id="word"/></td>
                        <td width="30%" align="left"><input type="button" value="Translate" id="translate"/></td>
                    </tr>
                </table>
            </td>
            <td style="width:80%;height:auto">
            </td>
            
        </tr>
        <tr>
        	<td></td>
            <td id="meaning">
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
            </td>
        </tr>
	</table>
</form>